<template>
    <div class="son">
        <p>子组件2</p>
        <button @click="fn">传递数据</button>
    </div>
</template>

<script lang="ts">
import { defineComponent } from "vue"
import $bus from "@/bus/index"

export default defineComponent({
    name: "Ch2",
    setup() {
        function fn() {
            $bus.emit(
                "poem",
                "十年生死两茫茫，不思量，自难忘。千里孤坟，无处话凄凉。纵使相逢应不识，尘满面，鬓如霜..."
            )
        }
        return { fn }
    },
})
</script>

<style scoped>
.son {
    width: 200px;
    height: 100px;
    border: 2px solid cadetblue;
}
</style>
